/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package de.sisoft.timera.entity;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

/**
 *
 * @author Christian Hildebrandt
 */
@Entity
public class Address implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    private String street;
    private String houseNumber;
    private String zipCode;
    private String city;

    @Override
    public boolean equals(final Object object) {
	// TODO: Warning - this method won't work in the case the id fields are
	// not set
	if (!(object instanceof Address)) {
	    return false;
	}
	final Address other = (Address) object;
	if (((id == null) && (other.id != null)) || ((id != null) && !id.equals(other.id))) {
	    return false;
	}
	return true;
    }

    public String getCity() {
	return city;
    }

    public String getHouseNumber() {
	return houseNumber;
    }

    public Long getId() {
	return id;
    }

    public String getStreet() {
	return street;
    }

    public String getZipCode() {
	return zipCode;
    }

    @Override
    public int hashCode() {
	int hash = 0;
	hash += (id != null ? id.hashCode() : 0);
	return hash;
    }

    public void setCity(final String city) {
	this.city = city;
    }

    public void setHouseNumber(final String houseNumber) {
	this.houseNumber = houseNumber;
    }

    public void setId(final Long id) {
	this.id = id;
    }

    public void setStreet(final String street) {
	this.street = street;
    }

    public void setZipCode(final String zipCode) {
	this.zipCode = zipCode;
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
	return street + " " + houseNumber + ", " + zipCode + " " + city;
    }

}
